// 拿到某个对象的某个key 对应的值

const obj = {
  name: '张三',
  age: 18,
  gender: '男',
  address: '北京',
  phone: '12345678901',
  email: 'zhangsan@163.com',
}


function getObjValue<T extends object, K extends keyof T>(obj: T, key: K): T[K] {
  return obj[key];
}

console.log(getObjValue(obj, 'name'));

// parse query string  too hard, let's do it later
// type ParseParam<Param extends string> =
//   Param extends `${infer Key}=${infer Value}` ?
//   {
//     [K in Key]: Value
//   } : {}
